package com.example.demo.controller;

import com.example.demo.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

/**
 * Created by gaDZS on 2017/8/11.
 */
@RestController
public class HelloController {

    @Autowired
    HelloService helloService;


    @RequestMapping("/hello")
    public ModelAndView  hello(Map<String,Object> map){
        ModelAndView mv = new ModelAndView("hello1");
        mv.addObject("param"," hello spring cloud !");
        return mv;
    }

    @RequestMapping("/hello2")
    public String  hello2(@RequestParam String id){
        return helloService.getInfo(id);
    }
}
